
cc.Class({
    extends: cc.Component,

    properties: {
     highscore:cc.Label,
     score:cc.Label,
     restart:cc.Node,
     glaworm:cc.ParticleSystem,
    },

    

   onLoad () {
    
    this.score.string = "score:" + cc.data.game_score;
    
    cc.data.game_highscore = cc.sys.localStorage.getItem("Rubber_monster");
    if(cc.data.game_score > Number(cc.data.game_highscore)){
        this.glaworm.node.active = true;
        cc.sys.localStorage.setItem("Rubber_monster",cc.data.game_score);      
    }
    cc.log(cc.sys.localStorage.getItem("Rubber_monster"));
    this.highscore.string = "highscore:" + cc.sys.localStorage.getItem("Rubber_monster");

   },

    onbuttonclick:function(){
     this.restart.active = false;   
     cc.director.loadScene("game");
    },

    start () {

    },

    // update (dt) {},
});
